// 定义全局 SCSS 变量和混合器
@mixin flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

@mixin line-clamp($lines) {
  display: -webkit-box;
  -webkit-line-clamp: $lines;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

// 全局样式
:root {
  --primary-color: theme('colors.primary.600');
  --success-color: theme('colors.success.600');
}

// 深色模式全局样式
:root.dark {
  --el-bg-color: #1a1a1a;
  --el-bg-color-overlay: #242424;
  --el-text-color-primary: #e5eaf3;
  --el-text-color-regular: #cfd3dc;
  --el-text-color-secondary: #a3a6ad;
  --el-border-color: #4c4d4f;
  --el-border-color-light: #363637;
  --el-fill-color-blank: #1a1a1a;
  --el-mask-color: rgba(0, 0, 0, 0.8);
  --el-mask-color-extra-light: rgba(0, 0, 0, 0.3);
  
  // Element Plus 组件深色模式变量
  --el-fill-color: var(--el-bg-color);
  --el-fill-color-light: #2c2c2c;
  --el-fill-color-lighter: #262626;
  --el-fill-color-extra-light: #191919;
  --el-border-color-darker: #636363;
  --el-border-color-dark: #5c5c5c;
  
  // Rate 组件深色模式
  --el-rate-void-color: #4c4d4f;
  --el-rate-star-color: #ffd21e;
  --el-rate-disabled-void-color: #4c4d4f;
  
  // Tag 组件深色模式
  --el-tag-bg-color: #2c2c2c;
  --el-tag-border-color: #4c4d4f;
  --el-tag-text-color: #e5eaf3;
  --el-tag-hover-bg-color: #363637;
  
  // 分页组件深色模式
  --el-pagination-bg-color: transparent;
  --el-pagination-hover-color: var(--el-color-primary);
  --el-pagination-button-bg-color: #2c2c2c;
  --el-pagination-button-disabled-bg-color: #1a1a1a;
  
  color-scheme: dark;
}

body {
  @apply bg-white text-gray-900 transition-colors duration-300;
  
  &.dark {
    @apply bg-gray-900 text-gray-100;
  }
}

// 修复 Tailwind 和 Element Plus 的样式冲突
.el-button {
  @apply m-0;
}

.el-input__wrapper {
  @apply shadow-none;
}

// 深色模式下的Element Plus组件样式覆盖
.dark {
  .el-card {
    @apply bg-gray-800 border-gray-700;
    
    .el-card__header {
      @apply border-gray-700;
    }
  }
  
  .el-dialog {
    @apply bg-gray-800;
    
    .el-dialog__header {
      @apply border-gray-700;
    }
  }
  
  .el-table {
    @apply bg-gray-800;
    
    th.el-table__cell {
      @apply bg-gray-700;
    }
    
    .el-table__row {
      @apply hover:bg-gray-700;
    }
  }
  
  .el-tabs__nav-wrap::after {
    @apply bg-gray-700;
  }
  
  .el-tabs__item {
    @apply text-gray-400;
    
    &.is-active {
      @apply text-primary-400;
    }
  }
  
  .el-form-item__label {
    @apply text-gray-300;
  }
  
  .el-input__wrapper,
  .el-textarea__wrapper {
    @apply bg-gray-700 border-gray-600;
    
    input,
    textarea {
      @apply text-gray-300;
      
      &::placeholder {
        @apply text-gray-500;
      }
    }
  }
  
  .el-button--default {
    @apply bg-gray-700 border-gray-600 text-gray-300;
    
    &:hover {
      @apply bg-gray-600 border-gray-500;
    }
  }
  
  .el-radio-button__inner {
    @apply bg-gray-700 border-gray-600 text-gray-300;
  }
  
  .el-tag {
    &.el-tag--info {
      background-color: var(--el-tag-bg-color);
      border-color: var(--el-tag-border-color);
      color: var(--el-tag-text-color);
      
      &:hover {
        background-color: var(--el-tag-hover-bg-color);
      }
    }
  }
  
  .el-pagination {
    --el-pagination-bg-color: transparent;
    --el-pagination-hover-color: var(--el-color-primary);
    --el-pagination-button-bg-color: #2c2c2c;
    --el-pagination-button-disabled-bg-color: #1a1a1a;
    
    .el-pager li {
      background-color: var(--el-pagination-button-bg-color);
      color: var(--el-text-color-regular);
      
      &.is-active {
        background-color: var(--el-color-primary);
        color: #fff;
      }
      
      &:hover {
        color: var(--el-pagination-hover-color);
      }
    }
    
    .btn-prev,
    .btn-next {
      background-color: var(--el-pagination-button-bg-color);
      
      &:disabled {
        background-color: var(--el-pagination-button-disabled-bg-color);
      }
    }
  }
}

// 自定义全局样式类
.page-container {
  @apply container mx-auto px-4 py-8 transition-colors duration-300;
}

.section-title {
  @apply text-2xl font-bold text-gray-900 dark:text-gray-100 mb-6;
}

.card-shadow {
  @apply shadow-sm hover:shadow-md transition-shadow duration-300 bg-white dark:bg-gray-800;
}

// 响应式工具类
.responsive-container {
  @apply w-full max-w-7xl mx-auto px-4 sm:px-6 lg:px-8;
}

.responsive-grid {
  @apply grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6;
}

// 动画类
.fade-enter-active,
.fade-leave-active {
  @apply transition-opacity duration-300;
}

.fade-enter-from,
.fade-leave-to {
  @apply opacity-0;
}

.slide-up-enter-active,
.slide-up-leave-active {
  @apply transition-all duration-300;
}

.slide-up-enter-from,
.slide-up-leave-to {
  @apply opacity-0 transform translate-y-4;
}

// 工具类
.aspect-square {
  aspect-ratio: 1 / 1;
}

.aspect-video {
  aspect-ratio: 16 / 9;
}

.line-clamp-1 {
  @include line-clamp(1);
}

.line-clamp-2 {
  @include line-clamp(2);
}

.line-clamp-3 {
  @include line-clamp(3);
}

// Element Plus 深色模式组件样式覆盖
.dark {
  .el-rate {
    --el-rate-void-color: #4c4d4f;
    --el-rate-star-color: #ffd21e;
    --el-rate-disabled-void-color: #4c4d4f;
  }
  
  .el-tag {
    &.el-tag--info {
      background-color: var(--el-tag-bg-color);
      border-color: var(--el-tag-border-color);
      color: var(--el-tag-text-color);
      
      &:hover {
        background-color: var(--el-tag-hover-bg-color);
      }
    }
  }
  
  .el-pagination {
    --el-pagination-bg-color: transparent;
    --el-pagination-hover-color: var(--el-color-primary);
    --el-pagination-button-bg-color: #2c2c2c;
    --el-pagination-button-disabled-bg-color: #1a1a1a;
    
    .el-pager li {
      background-color: var(--el-pagination-button-bg-color);
      color: var(--el-text-color-regular);
      
      &.is-active {
        background-color: var(--el-color-primary);
        color: #fff;
      }
      
      &:hover {
        color: var(--el-pagination-hover-color);
      }
    }
    
    .btn-prev,
    .btn-next {
      background-color: var(--el-pagination-button-bg-color);
      
      &:disabled {
        background-color: var(--el-pagination-button-disabled-bg-color);
      }
    }
  }
} 